/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

import com.etop.weibo.beans.Secret;
import com.etop.weibo.dao.DAOFactory;
import com.etop.weibo.dao.SecretDao;
import java.util.Date;
import java.util.List;
import org.junit.Test;

/**
 *
 * @author jansing
 */
public class SecretCRUD {

    public void testCast(){
        Object s = "test";
        int number = (int) s;
    }
    
    @Test
    public void hasRead(){
//        DAOFactory.getSecretDao().hasRead(2, 1);
    }
    
    public void List01(){
        List<Secret> list = DAOFactory.getSecretDao().secretList(1, 103);
        for(Secret se : list){
            System.out.println(se.getFromId() + " -> " + se.getToId() + " : " + se.getWhat());
        }
            
    }
    
    public void AllHasNew01(){
        System.out.println(DAOFactory.getSecretDao().hasNew(1));
    }
    
    public void HasNew01(){
        System.out.println(DAOFactory.getSecretDao().hasNew(1, 103));
    }
    
    public void HasAllRead01(){
        DAOFactory.getSecretDao().allHasRead(103);
    }
    
    public void HasRead01(){
//        DAOFactory.getSecretDao().hasRead(10, 1);
    }
    
    public void Add01() {
        Secret secret = new Secret();
        secret.setCreateTime(new Date());
        secret.setFromId(1);
        secret.setToId(103);
        secret.setWhat("该怎么说让彼此选择但思念还转动");
        secret.setIsNew(true);
        DAOFactory.getSecretDao().add(secret);

    }
    public void Add02(){
        Secret secret = new Secret();
        secret.setCreateTime(new Date());
        secret.setFromId(103);
        secret.setToId(1);
        secret.setWhat("不能握的手 从此匿名的朋友");
        secret.setIsNew(true);
        DAOFactory.getSecretDao().add(secret);

    }
}
